package cn.showplus.start;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer;
import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer;
import org.springframework.context.annotation.ComponentScan;

/**
 * Created by sunfeihu on 2017/4/12.
 */
@SpringBootApplication
@ComponentScan(basePackages = {"cn.showplus.**"})
public class Application implements EmbeddedServletContainerCustomizer {

    public static Integer port = 8080;

    public static void main(String[] args) {
        try {
            port = Integer.parseInt(args[0]);
        } catch (Exception e) {

        }
        SpringApplication.run(Application.class, args);
    }

    @Override
    public void customize(ConfigurableEmbeddedServletContainer configurableEmbeddedServletContainer) {
        configurableEmbeddedServletContainer.setPort(port);
    }

}